import 'package:flutter/material.dart';
import 'dart:async';

import 'package:learn_canvas/learn_canvas.dart' as learn_canvas;
import 'package:learn_canvas_example/2/painter_box.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late int sumResult;
  late Future<int> sumAsyncResult;

  @override
  void initState() {
    super.initState();
    sumResult = learn_canvas.sum(1, 2);
    sumAsyncResult = learn_canvas.sumAsync(3, 4);
  }

  @override
  Widget build(BuildContext context) {
    const textStyle = TextStyle(fontSize: 25);
    const spacerSmall = SizedBox(height: 10);
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('学习 Native'),
        ),
        body: Center(
          child: SizedBox(
            width: 300,
            height: 300,
            child: CustomPaint(
              // size: const Size(300, 300),
              painter: PainterBox(),
            ),
          ),
        ),
      ),
    );
  }
}
